package com.neusoft.model;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.neusoft.bean.Admins;
import com.neusoft.db.DBFactory;

public class LoginValidate {
	
	public boolean loginValidate(String adminName,String adminPsw) {
		boolean isLogin = false;
		String sql = "select adminname,adminpsw from admins";
		
		List<Admins> adl = DBFactory.getDBProviderInstance().query(sql, new BeanListHandler<>(Admins.class));
		for (Admins admin : adl) {
			System.out.println(admin);
		}
		for (Admins admin : adl) {
			if (admin.getAdminname().equals(adminName)&&admin.getAdminpsw().equals(adminPsw)) {
				isLogin=true;
			} else {
				isLogin=false;
			}
		}
		return isLogin;
	}

	
}
